
@extends('Admin.common.header')

<meta name="csrf-token" content="{{ csrf_token() }}">


<!--  页面标记  -->
<div class="container" >
	<div style="padding: 63px 0 33px 0;">
		<h2>{{ $title or '' }}</h2>
	</div>
</div>



<div>
	<!--  轮播 表格  -->
	<table class="table" style="margin-left:66px;width:88%;">
			<tr style="">
				<td>id</td>
				<td>图片预览</td>
				<td>图片地址</td>
				<td>链接地址</td>
				<td>操作</td>
			</tr>
		@foreach($shufflings_info as $shuffling_info)
			
			<tr style="">
				<td>{{ $shuffling_info->id }}</td>
				<td style="padding: 21px 19px;">
					<img style="width:300px;" src="{{ $shuffling_info->pic_url }}" alt="">
				</td>
				<td style="width:370px;" >{{ $shuffling_info->pic_url }}</td>
				<td style="">{{ $shuffling_info->next_url }}</td>
				<td style="">
					@if( $shuffling_info->status == 1 )
						<a href="{{ asset('/shuffling/create') }}/{{ $shuffling_info->id }}">编辑 </a>
						<span> | </span>
						<a onclick="overDate( {{ $shuffling_info->id }} );"> 过期</a>
					@else
						<span>已过期</span>
					@endif
					
				</td>
			</tr>
			
		@endforeach
	</table>
</div>
<script src=" {{ asset('./js/jquery-1.8.3.min.js') }} "></script>
<script type="text/javascript">
	<!-- 2.设置全局ajax选项 -->
	$.ajaxSetup({
		headers: {
			'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
		}
	});
	var _token = $('meta[name="csrf-token"]').attr('content');
	
	// 轮播 过期
	function overDate( id )
	{
		if( confirm("确认要过期吗？") )
		{
			$.ajax({
				type:"post",
				url:"{{ url('/shuffling/overDate') }}"+'/'+id,
				data:{_token:_token},
				async:true,    					
				dataType:"text",
				success:function(back){
					if(back=='1')
					{
						// 过期成功
						location.reload();
					}else
					{
						alert( '操作失败' );
					}
				}
			});
		}
	}

</script>


@extends('Admin.common.footer')